<template>
	<view class="reward-page">
		<y-cubar title="我的奖励" :bgColor="`rgba(255,255,255,${opacity})`" />
		<view class="reward-page-bg"></view>
		<view class="card">
			<image class="card-bg" src="/static/user/reward-bg.png" mode=""></image>
			<view class="card-info">
				<view class="card-info-left">
					<view class="name">奖励余额</view>
					<view class="num">0</view>
				</view>
				<button class="cu-btn">立即提现</button>
			</view>
		</view>
		<view class="con">
			<view class="title">余额明细</view>
			<common-list :isDataEmpty="tableData.length === 0" :status="status">
				<template #list>
					<view>
						<view class="list">
							<view class="item" v-for="(item, index) in tableData" :key="index">
								<view class="info">
									<view class="name">租车奖励</view>
									<view class="date">2023-07-18 16:09:09</view>
								</view>
								<view class="num">+500</view>
							</view>
						</view>
					</view>
				</template>
			</common-list>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'
	import {
		onPageScroll
	} from "@dcloudio/uni-app";
	import YCubar from '@/components/y-cubar/index.vue'
	import CommonList from '@/components/commonList/list.vue'
	const opacity = ref(0)
	onPageScroll((e) => {
		const childerOpa = Number((e.scrollTop / 200).toFixed(2))
		opacity.value = childerOpa >= 1 ? 1 : childerOpa
	})

	const tableData = ref([{}, {}])
	const status = ref('nomore')
</script>

<style lang="scss" scoped>
	.reward-page {
		min-height: 100vh;
		background-color: #fff;
		padding-bottom: 150rpx;
		padding-bottom: calc(constant(safe-area-inset-bottom) + 150rpx);
		padding-bottom: calc(env(safe-area-inset-bottom) + 150rpx);

		&-bg {
			width: 750rpx;
			height: 534rpx;
			background: linear-gradient(180deg, #FFC434 0%, #FFCE55 29%, #F5F5F5 100%);
			position: absolute;
			top: 0;
		}

		.card {
			position: relative;
			z-index: 3;
			width: 650rpx;
			height: 158rpx;
			position: relative;
			margin: 40rpx auto 0 auto;

			&-bg {
				position: absolute;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				display: block;
			}

			&-info {
				position: relative;
				height: 100%;
				z-index: 4;
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 0 52rpx;

				&-left {
					.name {
						font-size: 26rpx;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #95673B;
					}

					.num {
						margin-top: 10rpx;
						font-size: 48rpx;
						font-family: PingFang SC-Heavy, PingFang SC;
						font-weight: 800;
						color: #803C00;
					}
				}

				.cu-btn {
					height: 70rpx;
					background: linear-gradient(180deg, #FFBE2F 0%, #FC792D 100%);
					border-radius: 16rpx;
					font-size: 30rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #FFFFFF;
				}
			}
		}

		.con {
			margin-top: -20rpx;
			position: relative;
			z-index: 4;
			background-color: #fff;
			border-radius: 20rpx 20rpx 0 0;
			padding: 32rpx 24rpx;

			.title {
				font-size: 32rpx;
				font-family: PingFang SC-Bold, PingFang SC;
				font-weight: bold;
				color: #333333;
			}
		}

		.list {
			padding: 20rpx 0;

			.item {
				padding: 28rpx 0;
				border-bottom: 1rpx solid #EEEEEE;
				display: flex;
				align-items: center;
				justify-content: space-between;

				&:not(:first-child) {
					margin-top: 40rpx;
				}

				.info {
					.name {
						font-size: 30rpx;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #333333;
					}

					.date {
						margin-top: 8rpx;
						font-size: 24rpx;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #999999;
					}
				}

				.num {
					font-size: 32rpx;
					font-family: PingFang SC-Bold, PingFang SC;
					font-weight: bold;
					color: #333333;
				}
			}
		}
	}
</style>